<!DOCTYPE html>
<html lang="zh-cmn-CN" ng-app="danmu.manage" ng-controller="MainCtrl">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="/static/bootstrap/css/bootstrap-theme.min.css" rel="stylesheet">
    <link href="/static/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <script src="/static/angular/angular.min.js"></script>
    <script src="/static/angular-ui-bootstrap/ui-bootstrap-tpls.min.js"></script>
    <link href="/manage.css" rel="stylesheet">
    <title>系统管理</title>
</head>

<body>
    <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
        <div class="container-fluid">
            <div class="navbar-header"><a class="navbar-brand" href="#">系统管理</a></div>
        </div>
    </nav>
    <div class="container-fluid">
        <div class="row">
            <uib-alert type="danger" ng-show="haveError">错误{{err.code}}：{{err.desc}}；建议刷新页面。</uib-alert>
            <div class="col-sm-12 col-md-12 main">
                <uib-accordion close-others="accordion.closeOther">
                    <uib-accordion-group heading="管理信息" is-open="accordion.openInfo" is-disabled="accordion.disableInfo">
                        <div class="container">
                            <uib-alert type="danger" ng-show="!isLogin">务必先填入房间信息再进行管理。</uib-alert>
                            <uib-alert type="success" ng-show="isLogin">你选择了{{room}}房间</uib-alert>
                            <div class="list-group" ng-show="!isLogin">
                                <a href="#" class="list-group-item" ng-class="{active: room == roomS.id}" ng-repeat="roomS in roomList" ng-click="initRoom(roomS.id)">{{roomS.display}} ({{roomS.id}})</a>
                            </div>
                            <form ng-submit="enterRoom(password)" ng-show="!isLogin">
                                <div class="input-group">
                                    <input type="password" class="form-control" placeholder="房间密码" ng-model="password">
                                    <span class="input-group-btn">
                            <button class="btn btn-success" type="submit">确认</button>
                        </span>
                                </div>
                            </form>
                        </div>
                    </uib-accordion-group>
                    <uib-accordion-group heading="弹幕搜索" is-open="accordion.openDanmu">
                        <div ng-controller="DanmuCtrl" class="container">
                            <form ng-submit="danmu.doSearch()">
                                <div class="input-group">
                                    <input type="text" class="form-control" placeholder="搜索弹幕" ng-model="danmu.searchKey">
                                    <span class="input-group-btn">
                            <button class="btn btn-success" type="submit">搜索</button>
                        </span>
                                </div>
                            </form>
                            <div class="row">
                                <p>
                                    <br/>
                                </p>
                                <table class="table table-hover">
                                    <tr>
                                        <th>ID</th>
                                        <th>用户</th>
                                        <th>弹幕</th>
                                    </tr>
                                    <tr ng-repeat="item in danmu.result">
                                        <td>{{item.id}}</td>
                                        <td>{{item.user}}</td>
                                        <td>{{item.text}}</td>
                                    </tr>
                                </table>
                            </div>
                        </div>
                    </uib-accordion-group>
                    <uib-accordion-group heading="黑名单管理" is-open="accordion.openBlock">
                        <div ng-controller="BlockCtrl" class="container">
                            <form ng-submit="block.doAdd()">
                                <div class="input-group">
                                    <input type="text" class="form-control" placeholder="添加用户" ng-model="block.textUser">
                                    <span class="input-group-btn">
                                    <button class="btn btn-success" type="submit">添加</button>
                                    </span>
                                </div>
                            </form>
                            <div class="row">
                                <p>
                                    <br/>
                                </p>
                                <button type="button" class="btn btn-primary btn-sm" ng-repeat="item in block.result track by $index" style="margin-right: 5px" ng-click="block.doRemove(item)" ng-value="item">{{item}}</button>
                            </div>
                        </div>
                    </uib-accordion-group>
                    <uib-accordion-group heading="权限设置" is-open="accordion.openPermissions">
                        <div ng-controller="PermissionCtrl" class="container">
                            <form class="form-horizontal" ng-submit="$submitPermissions()">
                                <div class="form-group">
                                    <label for="permissionSend" class="col-sm-2 control-label">弹幕接收开关</label>
                                    <div class="col-sm-10">
                                        <button type="button" class="btn" ng-class="$makeClass('send')" id="permissionSend" ng-click="$setState('send')">当前状态：{{$getStateText('send')}}</button> <small>关闭后不再接收任何新弹幕</small>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="permissionStyle" class="col-sm-2 control-label">弹幕样式开关</label>
                                    <div class="col-sm-10">
                                        <button type="button" class="btn" ng-class="$makeClass('style')" id="permissionStyle" ng-click="$setState('style')">当前状态：{{$getStateText('style')}}</button>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="permissionColor" class="col-sm-2 control-label">颜色设置开关</label>
                                    <div class="col-sm-10">
                                        <button type="button" class="btn" ng-class="$makeClass('color')" id="permissionColor" ng-click="$setState('color')">当前状态：{{$getStateText('color')}}</button>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="permissionTextStyle" class="col-sm-2 control-label">文字样式开关</label>
                                    <div class="col-sm-10">
                                        <button type="button" class="btn" ng-class="$makeClass('textStyle')" id="permissionTextStyle" ng-click="$setState('textStyle')">当前状态：{{$getStateText('textStyle')}}</button>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="permissionHeight" class="col-sm-2 control-label">高度设置开关</label>
                                    <div class="col-sm-10">
                                        <button type="button" class="btn" ng-class="$makeClass('height')" id="permissionHeight" ng-click="$setState('height')">当前状态：{{$getStateText('height')}}</button>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="permissionLifeTime" class="col-sm-2 control-label">时间设置开关</label>
                                    <div class="col-sm-10">
                                        <button type="button" class="btn" ng-class="$makeClass('lifeTime')" id="permissionLifeTime" ng-click="$setState('lifeTime')">当前状态：{{$getStateText('lifeTime')}}</button>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="permissionSourceCode" class="col-sm-2 control-label">自定义弹幕开关</label>
                                    <div class="col-sm-10">
                                        <button type="button" class="btn" ng-class="$makeClass('sourceCode')" id="permissionSourceCode" ng-click="$setState('sourceCode')">当前状态：{{$getStateText('sourceCode')}}</button> <small>此权限要求弹幕样式开关一并打开才可使用。非常危险，可能导致客户端出现莫名错误，对非信任用户不要打开！</small>
                                    </div>
                                </div>
                                <div class="row">
                                    <button class="col-sm-offset-5 btn btn-success" type="submit">更新权限</button>
                                </div>
                            </form>
                        </div>
                    </uib-accordion-group>
                    <uib-accordion-group heading="参数设置" is-open="accordion.openConfig">
                        <div ng-controller="ConfigCtrl" class="container">
                            <form class="form-horizontal" ng-submit="config.submitConfig()">
                                <div class="form-group">
                                    <label for="configReplaceKeyword" class="col-sm-2 control-label">替换关键词</label>
                                    <div class="col-sm-10">
                                        <input type="text" class="form-control" id="configReplaceKeyword" placeholder="" ng-model="config.realConfig.replaceKeyword">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="configBlockKeyword" class="col-sm-2 control-label">拦截关键词</label>
                                    <div class="col-sm-10">
                                        <input type="text" class="form-control" id="configBlockKeyword" placeholder="" ng-model="config.realConfig.blockKeyword">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="configIgnoreKeyword" class="col-sm-2 control-label">判断拦截时忽略关键词</label>
                                    <div class="col-sm-10">
                                        <input type="text" class="form-control" id="configIgnoreKeyword" placeholder="" ng-model="config.realConfig.ignoreKeyword">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="configSocketInterval" class="col-sm-2 control-label">弹幕向客户端发送间隔</label>
                                    <div class="col-sm-10">
                                        <input type="number" class="form-control" id="configSocketInterval" placeholder="" ng-model="config.realConfig.socketinterval">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="configSocketSingle" class="col-sm-2 control-label">每次弹幕发送数量</label>
                                    <div class="col-sm-10">
                                        <input type="number" class="form-control" id="configSocketSingle" placeholder="" ng-model="config.realConfig.socketsingle">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="configRoomLength" class="col-sm-2 control-label">弹幕堆积队列最大长度</label>
                                    <div class="col-sm-10">
                                        <input type="number" class="form-control" id="configRoomLength" placeholder="" ng-model="config.realConfig.maxlength">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="configTextLength" class="col-sm-2 control-label">单条弹幕最大长度</label>
                                    <div class="col-sm-10">
                                        <input type="number" class="form-control" id="configTextLength" placeholder="" ng-model="config.realConfig.textlength">
                                    </div>
                                </div>
                                <div class="row">
                                    <button class="col-sm-offset-5 btn btn-success" type="submit">更新配置</button>
                                </div>
                            </form>
                        </div>
                    </uib-accordion-group>
                    <uib-accordion-group heading="密码设置" is-open="accordion.openPassword">
                        <div ng-controller="PasswordCtrl" class="container">
                            <form class="form-horizontal" ng-submit="$submitPassword('advanced')">
                                <div class="form-group">
                                    <label for="passwordAdvanced" class="col-sm-2 control-label">高级弹幕发送密码</label>
                                    <div class="col-sm-8"><input type="password" class="form-control" id="passwordAdvanced" placeholder="" ng-model="config.advancedpassword"></div>
                                    <div class="col-sm-1"><button class="col-sm-offset-5 btn btn-success" type="submit">更新密码</button></div>
                                </div>
                            </form>
                            <form class="form-horizontal" ng-submit="$submitPassword('manage')">
                                <div class="form-group">
                                    <label for="passwordManage" class="col-sm-2 control-label">后台管理密码</label>
                                    <div class="col-sm-8"><input type="password" class="form-control" id="passwordManage" placeholder="" ng-model="config.managepassword"></div>
                                    <div class="col-sm-1"><button class="col-sm-offset-5 btn btn-success" type="submit">更新密码</button></div>
                                </div>
                            </form>
                            <form class="form-horizontal" ng-submit="$submitPassword('connect')">
                                <div class="form-group">
                                    <label for="passwordConnect" class="col-sm-2 control-label">客户端连接密码</label>
                                    <div class="col-sm-8"><input type="password" class="form-control" id="passwordConnect" placeholder="" ng-model="config.connectpassword"></div>
                                    <div class="col-sm-1"><button class="col-sm-offset-5 btn btn-success" type="submit">更新密码</button></div>
                                </div>
                            </form>
                        </div>
                    </uib-accordion-group>
                </uib-accordion>
            </div>
        </div>
    </div>
    <script src="/manage.js"></script>
</body>

</html>
